<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增项目设计变更单')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: jasny-bootstrap-css" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
    <th:block th:include="include :: summernote-css" />
    <style>
		.file-preview {
		    padding: 0;
		    margin-bottom: 0;
		    border-radius: 0;
		    border: none;
		}
		
		.krajee-default.file-preview-frame {
		    margin-right: 20px;
		    padding: 0;
		    border: none;
		    box-shadow: none;
		}
		
		.krajee-default.file-preview-frame:not(.file-preview-error):hover {
		    border: none;
		    box-shadow: none;
		}
		
		.krajee-default .file-footer-caption {
			margin-bottom: 0;
		}
		
		.krajee-default.file-preview-frame .file-thumbnail-footer {
		    height: auto;
		}
		
		.krajee-default .file-caption-info {
			width: auto;
		}
		
		.kv-upload-progress .progress {
			margin-top: 0;
		}
		
		.krajee-default.file-preview-frame .kv-file-content,
		.krajee-default .file-size-info,
		.krajee-default .file-upload-indicator,
		.file-input .kv-file-upload,
		.file-input .kv-file-zoom {
			display: none;
		}
		
		.file-input .kv-file-remove {
			position: absolute;
			top: 3px;
			right: -15px;
			height: 14px;
			padding: 0;
			margin: 0;
			border: none;
			background: none;
		}
		
		.file-input .kv-file-remove:active, 
		.file-input .kv-file-remove:focus {
			background: none;
			outline: none;
			box-shadow: none;
		}
		
		.file-input .kv-file-remove .glyphicon-trash {
			color: red;
		}
	</style>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-change-add">
        	<input name="gcProjectid" type="hidden" id="gcProjectid" th:value="${gcProject.id}">
        	<input type="hidden" id="approvename" name="approvename" th:value="${approvename}" />
        	<input id="zlwj" name="zlwj" type="hidden">
        	<div class="form-group">    
                <label class="col-sm-2 control-label is-required">对接部门：</label>
                <div class="col-sm-4">
                    <input name="dept" class="form-control" type="text" th:value="${dept}" autoComplete="off" readonly="readonly" required>
                    <input name="deptId" th:value="${deptId}" type="hidden">
                </div>
                <label class="col-sm-2 control-label is-required">对接人：</label>
                <div class="col-sm-4">
                    <input name="owner" class="form-control" th:value="${owner}" readonly="readonly" type="text" autoComplete="off" required>
                	<input name="ownerId" th:value="${ownerId}" type="hidden">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">项目名称：</label>
                <div class="col-sm-4">
                    <input name="projectName" class="form-control" required type="text" th:value="${gcProject.name}" readonly="readonly" >
                </div>
                <label class="col-sm-2 control-label is-required">建设单位：</label>
                <div class="col-sm-4">
                    <input name="clientName" class="form-control" required type="text" th:value="${gcProject.customerName}" readonly="readonly" >
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">变更单编号：</label>
                <div class="col-sm-4">
                    <input name="orderNo" class="form-control" type="text" required>
                </div>
                <label class="col-sm-2 control-label is-required">日期：</label>
                <div class="col-sm-4">
                    <div class="input-group date">
                        <input name="qfAt" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div> 
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">设计负责人：</label>
                <div class="col-sm-4">
                    <div class="input-group">
                    	<input id="sjfzr" name="sjfzr" class="form-control" type="hidden">
                    	<input id="sjfzrId" name="sjfzrId" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel1()" id="sjfzrStr" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
                <label class="col-sm-2 control-label is-required">专业负责人：</label>
                <div class="col-sm-4">
                    <div class="input-group">
                    	<input id="zyfzr" name="zyfzr" class="form-control" type="hidden">
                    	<input id="zyfzrId" name="zyfzrId" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel2()" id="zyfzrStr" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">审核人：</label>
                <div class="col-sm-4">
                    <div class="input-group">
                    	<input id="spr" name="spr" class="form-control" type="hidden">
                    	<input id="sprId" name="sprId" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel3()" id="sprStr" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
                <label class="col-sm-2 control-label is-required">校对负责人：</label>
                <div class="col-sm-4">
                    <div class="input-group">
                    	<input id="jdfzr" name="jdfzr" class="form-control" type="hidden">
                    	<input id="jdfzrId" name="jdfzrId" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel4()" id="jdfzrStr" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">项目负责人：</label>
                <div class="col-sm-4">
                    <div class="input-group">
                    	<input id="xmfzr" name="xmfzr" class="form-control" type="hidden">
                    	<input id="xmfzrId" name="xmfzrId" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel5()" id="xmfzrStr" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
                <label class="col-sm-2 control-label is-required">出图盖章人：</label>
                <div class="col-sm-4">
                    <div class="input-group">
                    	<input id="sdfzr" name="sdfzr" class="form-control" type="hidden">
                    	<input id="sdfzrId" name="sdfzrId" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel6()" id="sdfzrStr" readonly="true" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">
	            <label class="col-sm-2 control-label">附件：</label>
	            <div class="col-sm-10">
	            	<div class="file-loading">
		            	<input id="multipleFile" name="files" type="file" multiple>
		        	</div>
	            </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <th:block th:include="include :: bootstrap-suggest-js" />
    <th:block th:include="include :: bootstrap-typeahead-js" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <th:block th:include="include :: summernote-js" />
    <script th:inline="javascript">
        var prefix = ctx + "sj/change"
        $("#form-change-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/add", $('#form-change-add').serialize());
            }
        }

        $("input[name='qfAt']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        
        $(document).ready(function () {
        	$('.summernote').summernote({
            	lang: 'zh-CN'
        	});
        		
		       // 多图上传
		       $("#multipleFile").fileinput({
		           uploadUrl: "/common/uploads",
		           uploadAsync: false,
		           showClose: false,
		           showCancel: false,
		           dropZoneEnabled: false,
		           buttonLabelClass: ''
		       }).on('filebatchuploadsuccess', function (event, data, previewId, index) {
		       	var rsp = data.response;
//		       	   log.info("return urls：" + rsp.urls)
		           log.info("reutrn fileNames：" + rsp.fileNames)
//		           log.info("reutrn newFileNames：" + rsp.newFileNames)
//		           log.info("return originalFilenames：" + rsp.originalFilenames)
				   $("#zlwj").val(rsp.fileNames);
		       }).on('fileremoved', function (event, id, index) {
		           $("input[name='" + event.currentTarget.id + "']").val('')
		       })
		 });

      	//选择用户level1
		function selectlevel1() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel1User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel1User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#sjfzrId").val(rows[0].userId);
            $("#sjfzr").val(rows[0].userName);
            $("#sjfzrStr").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level2
		function selectlevel2() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel2User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel2User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#zyfzrId").val(rows[0].userId);
            $("#zyfzr").val(rows[0].userName);
            $("#zyfzrStr").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level3
		function selectlevel3() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel3User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel3User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#sprId").val(rows[0].userId);
            $("#spr").val(rows[0].userName);
            $("#sprStr").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level4
		function selectlevel4() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel4User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel4User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#jdfzrId").val(rows[0].userId);
            $("#jdfzr").val(rows[0].userName);
            $("#jdfzrStr").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level5
		function selectlevel5() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel5User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel5User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#xmfzrId").val(rows[0].userId);
            $("#xmfzr").val(rows[0].userName);
            $("#xmfzrStr").val(rows[0].userName);
            $.modal.closeAll();
        }
        
      //选择用户level6
		function selectlevel6() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel6User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel6User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#sdfzrId").val(rows[0].userId);
            $("#sdfzr").val(rows[0].userName);
            $("#sdfzrStr").val(rows[0].userName);
            $.modal.closeAll();
        }
    </script>
</body>
</html>